/*
 * Copyright 2010 Nicolas Lochet Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy of the License at
 *	
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and limitations under the License.
 */
package org.nicocube.wol.data.client;

import java.io.Serializable;
import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import org.nicocube.gwt.util.client.gender.Gender;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class User implements Serializable {
	private static final long serialVersionUID = 1L;

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;

	@Persistent
	private String login;

	@Persistent
	private String password;

	@Persistent
	private Date creationDate;
	
	@Persistent
	private String email;
	
	@Persistent
	private Date dateOfBirth;
	
	@Persistent
	private Gender gender;
	
	@Persistent
	private String country;
	
	@Persistent
	private String language;
	
	@Persistent
	private boolean acceptNewsLetter;
	
	@Persistent
	private boolean acceptPromotion;
	
	@Persistent
	private boolean acceptPartner;
	
	protected User() {}
	
	public User(String login, String password, String email, Date dateOfBirth,
			Gender gender, String country, String language,
			boolean acceptNewsLetter, boolean acceptPromotion,
			boolean acceptPartner) {
		super();
		this.login = login;
		this.password = password;
		this.creationDate = new Date();
		this.email = email;
		this.dateOfBirth = dateOfBirth;
		this.gender = gender;
		this.country = country;
		this.language = language;
		this.acceptNewsLetter = acceptNewsLetter;
		this.acceptPromotion = acceptPromotion;
		this.acceptPartner = acceptPartner;
	}
	
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public Long getId() {
		return id;
	}

	public String getLogin() {
		return login;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Date getDateOfBirth() {
		return dateOfBirth;
	}

	public void setDateOfBirth(Date dateOfBirth) {
		this.dateOfBirth = dateOfBirth;
	}

	public Gender getGender() {
		return gender;
	}
	
	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public boolean isAcceptNewsLetter() {
		return acceptNewsLetter;
	}

	public void setAcceptNewsLetter(boolean acceptNewsLetter) {
		this.acceptNewsLetter = acceptNewsLetter;
	}

	public boolean isAcceptPromotion() {
		return acceptPromotion;
	}

	public void setAcceptPromotion(boolean acceptPromotion) {
		this.acceptPromotion = acceptPromotion;
	}

	public boolean isAcceptPartner() {
		return acceptPartner;
	}

	public void setAcceptPartner(boolean acceptPartner) {
		this.acceptPartner = acceptPartner;
	}

}
